#ifndef TIMER_H
#define TIMER_H

#include <cstring>

#include "utils.h"
#include "device/Device.h"

#define TIMER_BASE 0xA0000048
#define TIMER_SIZE 8

class Timer: public Device {
public:
    Timer();
    bool read(word_t start_addr, size_t length, uint8_t* buffer, bool& mmio) override;
    bool write(word_t start_addr, size_t length, const uint8_t* buffer, bool& mmio) override;
    void update() override;
private:
    uint32_t timer[2];
    uint64_t boot_time;
    uint64_t get_time();
};

#endif
